<template>
  <div>
    <script :id=id type="text/plain">
    </div>
    </template>
    export default {
      name: 'UE',
      data () {
        return {
          editor: null
        }
      },
      props: {
        defaultMsg: {
          type: String
        },
        config: {
          type: Object
        },
        id: {
          type: String
        },
      },
      mounted() {

        this.editor = UE.getEditor(this.id, this.config); // 初始化UE

        this.editor.addListener("ready", function () {
          this.editor.setContent(this.defaultMsg); // 确保UE加载完成后，放入内容。
        }.bind(this));
      },
      methods: {
        getUEContent() { // 获取内容方法
          return this.editor.getContent()
        }
      },
      destroyed() {
        this.editor.destroy();
      }
    }
    </script>
